package generic

/**
 * Created by CJJ on 2017/7/18.
 */
fun main(args: Array<String>) {

    var water = Water()
    var bottle = Bottle(water)

    //var anotherBottle = Bottle(Empty())

}

class Bottle<T : Action> {
    var stuff: T? = null

    constructor(stuff: T) {
        this.stuff = stuff
    }


}


class Water : Action {
    override fun isLiquid(): Boolean {
        return true
    }

    override fun density(): Int {
        return 1000
    }

}

class Empty  {
     fun density(): Int {
        return 0
    }

     fun isLiquid(): Boolean {
        return false
    }

}